import { request } from "../../request/index.js";
import regeneratorRuntime from '../../lib/runtime/runtime';
Page({

    /**
     * 页面的初始数据
     */
    data: {
        watch: {}
    },
    onLoad(options) {
       var id  = options.id;
        this.getWatch(id);
    },

    async getWatch(id) {
        const watch = await request({ url: "/product/skuinfo/"+id+"/detail"});
        this.setData({
            watch: {   
                id:watch.data.id,
                image:watch.data.imgUrl,
                name: watch.data.title,
                descs:watch.data.subtitle,
                price:watch.data.price,
                address:watch.data.address,
                lng:watch.data.lng,
                lat:watch.data.lat,
                introduceImage:watch.data.decripts,
            }
        })
    },


    // 跳转订单页面
    handleOrder(){
        let cart = this.data.watch;
        cart.num = 1;
        wx.setStorageSync("cart",cart);
        wx.reLaunch({
            url: '/pages/pay/pay'
        });
    }

})